#!/bin/bash

#
# controlc -- by Dario Berzano <dario.berzano@gmail.com>
#
# Part of the lfscripts suite -- http://lfscripts.googecode.com/
#
# Outputs on screen the base64 version (thus, copiable and pastable) of the
# given list of files.
#

# Find correct base64
which gbase64 > /dev/null 2>&1
[ $? == 0 ] && B64=gbase64 || B64=base64

if [ $# == 0 ]; then
  echo "You should provide at least one argument."
  exit 1
fi

echo "-----BEGIN COPY HERE-----"
tar cjf - "$@" 2> /dev/null | "$B64"
echo "-----END COPY HERE-----"
